<?php
require('config.php');

        $mobile=$_REQUEST['mobile'];
        $pwd=$_REQUEST['pwd'];
        $user_id=$_REQUEST['user_id'];
		$sql="select * from `".$oto."_users` where `userId`='".$user_id."'";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$cha_mobile[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(!isset($cha_mobile))
		{
			$data[0]['pan']='-1';
			$data[0]['msg']="用户不存在";
		}
		else
		{
			if($cha_mobile[0]['userPhone']!=$mobile)
			{
				$data[0]['pan']='-1';
				$data[0]['msg']="手机号与原账号不匹配";
				echo json_encode($data);
				die();
			}
			$sjs=$cha_mobile[0]['loginSecret'];
			$userId=$cha_mobile[0]['userId'];
			$pwd=md5($pwd.$sjs);
            $sql="update ".$oto."_users set payPwd='{$pwd}' where userId='{$userId}'";
			$result=$db->query($sql);
            if($result)
            {
            	$data[0]['pan']='1';
            }
            else $data[0]['pan']='2';
		}
		echo json_encode($data);
?>